﻿using System;
using System.Collections.Generic;
using PluginService.DB.Contract;
using PluginService.DB.Model;
using PluginService.DB.Dao;
using IBatisNet.Common;

namespace PluginService.DB.Service
{
	public class BlankFeatureService : IBlankFeatureService
	{
		#region 变量

        BlankFeatureDao _blankFeatureDao;

		#endregion

		#region 属性
		/// <summary>
		/// BlankFeatureDao
		/// </summary>
		public BlankFeatureDao BlankFeatureDao
		{
            get { return _blankFeatureDao; }
            set { _blankFeatureDao = value; }
		}
		#endregion

		#region 事件

		#endregion

		#region 构造函数
		public BlankFeatureService()
		{
            _blankFeatureDao = new BlankFeatureDao();
		}
		public BlankFeatureService(string reader,string writer)
        {
            _blankFeatureDao = new BlankFeatureDao(reader, writer);
        }
		#endregion

		#region 方法
		/// <summary>
		/// 获取BlankFeature
		/// </summary>
		/// <param name="id">Id</param>
		/// <returns>BlankFeature</returns>
		public BlankFeature GetBlankFeature(System.Int64 id)
		{
            return _blankFeatureDao.GetBlankFeature(id);
		}

        public BlankFeature GetBlankFeatureByGuid(System.String guid)
        {
            return _blankFeatureDao.GetBlankFeatureByGuid(guid);
        }

        public bool DelBlankByGuid(System.String guid)
        {
            return _blankFeatureDao.DelBlankByGuid(guid);
        }
		
		/// <summary>
		/// 获取BlankFeature集合
		/// </summary>
		/// <param name="blankFeatureQp">BlankFeature</param>
		/// <returns>BlankFeature集合</returns>
		public IList<BlankFeature> GetBlankFeatures(BlankFeatureQP blankFeatureQp)
		{
            return _blankFeatureDao.GetBlankFeatures(blankFeatureQp);
		}

        public IList<BlankFeature> GetBlankFeaturesNoImages(BlankFeatureQP blankFeatureQp)
        {
            return _blankFeatureDao.GetBlankFeaturesNoImages(blankFeatureQp);
        }

		/// <summary>
		/// 获取指定查询条件下BlankFeature集合的记录数
		/// </summary>
		/// <param name="blankFeatureQp">BlankFeature</param>
		/// <returns>BlankFeature集合</returns>
		public int GetBlankFeaturesCount(BlankFeatureQP blankFeatureQp)
		{
            return _blankFeatureDao.GetBlankFeaturesCount(blankFeatureQp);
		}
		
		/// <summary>
		/// 有否BlankFeature
		/// </summary>
		/// <param name="id">Id</param>
		/// <returns>结果</returns>
		public bool HasBlankFeature(System.Int64 id)
		{
            return _blankFeatureDao.HasBlankFeature(id);
		}

		/// <summary>
		/// 插入BlankFeature
		/// </summary>
		/// <param name="blankFeature">BlankFeature</param>
		/// <returns>结果</returns>
		public int InsertBlankFeature(BlankFeature blankFeature)
		{
            return _blankFeatureDao.InsertBlankFeature(blankFeature);
		}

		///<summary>
		///删除BlankFeature
		///</summary>
		///<param name="id">Id</param>
		///<returns>结果</returns>
		public bool RemoveBlankFeature(System.Int64 id)
		{
            return _blankFeatureDao.RemoveBlankFeature(id);
		}
	
		/// <summary>
		/// 更新BlankFeature
		/// </summary>
		/// <param name="blankFeatureQp">BlankFeature</param>
		/// <returns>结果</returns>
		public bool UpdateBlankFeature(BlankFeatureQP blankFeatureQp)
		{
            return _blankFeatureDao.UpdateBlankFeature(blankFeatureQp);
		}

		/// <summary>
		/// 批量删除BlankFeature集合
		/// </summary>
		/// <param name="ids">Id集合</param>
		/// <returns>结果</returns>
		public bool RemoveBlankFeatures(IList<System.Int64> ids)
		{
			bool result = true;
            using (IDalSession session = BlankFeatureDao.Writer.BeginTransaction())
            {
                foreach (int id in ids)
                {
                    result = _blankFeatureDao.RemoveBlankFeature(id);
                }
                session.Complete();
            }
            return result;
		}

        public bool ClearBlankFeature()
        {
            return _blankFeatureDao.ClearBlankFeature();
        }
		#endregion
	}
}

